package com.demo.model;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;

import java.util.List;

/**
 * es索引实体
 * @author chenyongjiu
 */
@Data
@Document(indexName = "luna_person")
@AllArgsConstructor
@NoArgsConstructor
public class Person {
    @Id
    private Long id;
    /**
     * 将json的key映射到name属性。
     * json规范key的首字母必须小写
     */
    @JsonProperty("Name")
    private String name;
    @JsonProperty("Sex")
    private String sex;
    private int age;
    private List<String> identities;

    public Person(String name, int age) {
        this.name = name;
        this.age = age;
    }
}
